package br.ufcg.les;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.LinearLayout;

public class Nesquecer extends Activity {

	LinearLayout lista;
	CheckBox novoItem;
	EditText textoNovoItem;

	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.nesquecer);
		lista = (LinearLayout) findViewById(R.id.lista);
	}

	public void onclickback(View v) {
		Intent i = new Intent();
		i.setClass(this, BBQcalculatorActivity.class);
		startActivity(i);
	}

	public void adicionarItem(View v) {
		Context context = getApplication();
		novoItem = new CheckBox(context);
		textoNovoItem = (EditText) findViewById(R.id.txNOVO);
		novoItem.setText(textoNovoItem.getText().toString());
		lista.addView(novoItem, 0);
	}

	public void removerItem(View v) {
//		int i = 0;
//		while (lista.findViewById(i) != null) {
//			if (lista.findViewById(i).  == ""){
//				
//			}
//		}
		lista.removeViewAt(0);
		lista.removeViewAt(1);
	}
	
	// Menu
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		super.onCreateOptionsMenu(menu);
		MenuInflater inflater = getMenuInflater();
		inflater.inflate(R.menu.menu_nao_esquecer, menu);
		return true;
	}
	
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case R.menuNaoEsq.finalizar:
			Intent i = new Intent();
			i.setClass(this, BBQcalculatorActivity.class);
			startActivity(i);
		default:
			
			//finish();
			break;
		}
		return true;
	}
	// Fim menu
}
